New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for BananaPi BPi-R2 #1135
Conversation
fc07402
to
ca4c162
Compare
Backported from the vendor tree with additional patches to build with GCC 7. Signed-off-by: Nikolay Amiantov <ab@fmap.me>
It's useful on BPi-R2. Signed-off-by: Nikolay Amiantov <ab@fmap.me>
This is a minimal amount of patches to get the router functional: * Hardcode kernel cmdline arguments in DTB for now (which means only SD image works, EMMC requires different partition settings); * Fix device memory size; * Fix LEDs settings; * Enable PCIe support; * Enable TRGMII on both GMACs which fixes LAN. Non-functional features: * Internal Wi-Fi (but you can use a PCIe card); * HW NAT/HW QoS; Untested features: * HDMI; * GPIO pins. All the changes apart from hardcoding cmdline are picked from the vendor's 4.9 tree. Vendor supplements needed bootargs via u-boot instead, which for some reason doesn't work. Signed-off-by: Nikolay Amiantov <ab@fmap.me>
As mentioned in kernel patches only SD image is supported for now, however most needed code for EMMC images is added. Signed-off-by: Nikolay Amiantov <ab@fmap.me>
General idea is copied from the vendor tree. Signed-off-by: Nikolay Amiantov <ab@fmap.me>
Needed for MT6625L support on BananaPi BPi-R2.
Stand-alone WLAN drivers for Banana Pi BPi-R2.
Userspace part of WLAN drivers for BananaPi BPi-R2. Additionally implement wireless config initialization and start/stop/reload with quirks needed for the radio.
Certain wireless drivers (Mediatek) create interfaces by themselves and report "not supported" error when trying to create one from userspace. Handle this error code.
This is needed for some devices that handle non-zero values incorrectly, like BananaPi BPi-R2 onboard wifi chip.
Use phy device name as a last resort for identifying radios when reported MAC address is invalid. This is needed for Banana Pi BPi-R2 onboard wifi chip.
I've managed to implement working internal Wi-Fi. Things are still very quirky but it appears to work with stock OpenWrt infrastructure (with some changes). |
# This is free software, licensed under the GNU General Public License v2. | ||
# See /LICENSE for more information. | ||
# | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should be turned into a real image building code template and not a shell script from within the image code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would one do that? Maybe there are examples in the code tree that I can use?
@@ -18,6 +18,15 @@ platform_do_upgrade() { | |||
sync | |||
umount /tmp/recovery | |||
;; | |||
bananapi,bpi-r2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change included inside the patch does not correlate with the patches subject/description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure what do you mean - I add support for sysupgrade here, and it says so in the patch subject. Should I rename it somehow?
target/linux/mediatek/patches-4.14/0228-arm-dts-mtk-bpi-r2-bootargs.patch
Show resolved
Hide resolved
*/ | ||
memory { | ||
- reg = <0 0x80000000 0 0x20000000>; | ||
+ reg = <0 0x80000000 0 0x80000000>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch the dts file directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blogic Ping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abbradar: mt7623n-bananapi-bpi-r2.dts
is upstream DTS file, if there is something wrong in it, please send upstream patch for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least for 4.19+ this is already fixed in upstream by this commit
in 4.14 it is set to different value than these 2
blue { | ||
label = "bpi-r2:pio:blue"; | ||
- gpios = <&pio 241 GPIO_ACTIVE_HIGH>; | ||
+ gpios = <&pio 240 GPIO_ACTIVE_LOW>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch the dts file directly
}; | ||
|
||
+&pcie { | ||
+ pinctrl-names = "default"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch the dts file directly
@@ -58,6 +58,13 @@ CONFIG_BOUNCE=y | |||
CONFIG_CC_STACKPROTECTOR=y | |||
# CONFIG_CC_STACKPROTECTOR_NONE is not set | |||
CONFIG_CC_STACKPROTECTOR_REGULAR=y | |||
CONFIG_CFG80211=m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont use the kernel builtin cfg80211 layer
you are trying to add a driver with 1/4 million lines here cough :-) |
@abbradar Hi, although i really appreciate your effort in improving the bananpiR2 support, I must admit that chances of these changes getting merged are near 0. we could merge the memory size cleanup and the console/commandline fix but the rest wont ever hit the master tree. the wifi driver alone is 1/4 million lines of code, requires the in-kernel cfg80211 layer, hostapd hacks. The quality of the rest of the patches is somewhat questionable as it was most likely copied 1:1 from the SDK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blogic Many thanks for your review! I'll split and fix these patches, resubmitting some parts. I propose merging general improvements for the device, without internal WiFi support. Would this be okay?
*/ | ||
memory { | ||
- reg = <0 0x80000000 0 0x20000000>; | ||
+ reg = <0 0x80000000 0 0x80000000>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
@frank-w I'll try to rebase this atop master, will see what I can do. |
I've rebased and tested this; it works but for some reason jffs2 isn't mounted so there's no persistence. Unfortunately I had to RMA my CPU so I won't be able to look further for some time. |
This is a minimal amount of patches to build working images for Banana Pi BPi-R2. Remaining major issues now are:
Internal Wi-Fi is broken (see below);Developers from BananaPi provide half-complete drivers for Mediatek connectivity chip which apparently are hacked Android drivers. Because of this: